#include "stm32f10x.h"                  // Device header
#include "Delay.h"
#include "OLED.h"
#include "MyDMA.h"

int8_t arr1[4] = {1, 2, 3, 4};
int8_t arr2[4] = { 0 };
int32_t size = sizeof(arr1) / sizeof(arr1[0]);
int8_t i = 0;

int main(void)
{
	OLED_Init();
	MyDMA_Init((uint32_t)arr1, (uint32_t)arr2, size);
	OLED_ShowString(1, 1, "arr1");
	OLED_ShowString(3, 1, "arr2");
	
	OLED_ShowHexNum(1, 6, (uint32_t)arr1, 8);
	OLED_ShowHexNum(3, 6, (uint32_t)arr2, 8);
	while (1)
	{
	//显示arr1数据（源）
	OLED_ShowNum(2, 1, arr1[0], 2);
	OLED_ShowNum(2, 4, arr1[1], 2);
	OLED_ShowNum(2, 7, arr1[2], 2);
	OLED_ShowNum(2, 10, arr1[3], 2);

	MyDMA_Transfer(); //转运一次
	Delay_ms(1000);

	//显示arr2数据（目的地）
	OLED_ShowNum(4, 1, arr2[0], 2);
	OLED_ShowNum(4, 4, arr2[1], 2);
	OLED_ShowNum(4, 7, arr2[2], 2);
	OLED_ShowNum(4, 10, arr2[3], 2);	

	//arr1所有元素数值+1
	for (i = 0; i < size; i++)
	{
		arr1[i]++;
	}
	Delay_ms(1000);	
	}
}
